#include "bkinect.h"

#include <buola/io.h>

namespace buola { namespace bkinect {

BKinect::BKinect()
{
    bbox::register_service(this,"/org/buola/bkinect");
    mKinect.sImages.Connect([&](const img::CImage_rgb8 &pRGB,const img::CImage_gray32f &pDepth)
                            {   
                                OnCloud(pRGB,pDepth);
                            });
    mKinect.Start();
}

BKinect::~BKinect()
{

}

void BKinect::OnCloud(const img::CImage_rgb8 &pRGB, const img::CImage_gray32f &pDepth)
{
    oCloud.Output(cvi::make_cloud(pDepth,pRGB,mKinect.CameraParameters()));
}

/*namespace bkinect*/ } /*namespace buola*/ }

using namespace buola;

int main(int pNArgs,char **pArgs)
{
    buola_init(pNArgs,pArgs);
    bkinect::BKinect lService;
    buola_main_loop();
    return buola_finish();
}
